
import { type IComponentConfig, ChannelEnum } from '../../types'
import { dateTypes, placements, sizes } from '../util'

const props: IComponentConfig[] = [{
  type: 'select',
  component: 'eSelect',
  label: '显示类型',
  model: 'type',
  props: {
    dataSource: {
      type: 'static',
      value: dateTypes
    },
    transfer: true
  },
  defaultValue: 'date'
}, {
  type: 'input',
  component: 'eInput',
  label: '日期格式',
  model: 'format',
  defaultValue: 'yyyy-MM-dd'
}, {
  type: 'select',
  component: 'eSelect',
  label: '选择器出现的位置',
  model: 'placement',
  defaultValue: 'bottom-start',
  props: {
    dataSource: {
      type: 'static',
      value: placements
    },
    transfer: true
  }
}, {
  type: 'input',
  component: 'eInput',
  label: '占位文本',
  model: 'placeholder',
  defaultValue: '请选择'
}, {
  type: 'switch',
  component: 'eSwitch',
  label: '开启后，左右面板不联动',
  model: 'split-panels',
  defaultValue: false
}, {
  type: 'switch',
  component: 'eSwitch',
  label: '开启后，可以选择多个日期',
  model: 'multiple',
  defaultValue: false
}, {
  type: 'switch',
  component: 'eSwitch',
  label: '开启后，可以显示星期数',
  model: 'show-week-numbers',
  defaultValue: false
}, {
  type: 'switch',
  component: 'eSwitch',
  label: '是否显示底部控制栏',
  model: 'confirm',
  defaultValue: false
}, {
  type: 'switch',
  component: 'eSwitch',
  label: '是否禁用',
  model: 'disabled',
  defaultValue: false
}, {
  type: 'switch',
  component: 'eSwitch',
  label: '是否显示清除按钮',
  model: 'clearable',
  defaultValue: false
}, {
  type: 'switch',
  component: 'eSwitch',
  label: '是否将弹层放置于body内',
  model: 'transfer',
  defaultValue: false
}, {
  type: 'input',
  component: 'eInput',
  label: '两个日期间的分隔符',
  model: 'separator',
  defaultValue: '-'
}, {
  type: 'select',
  component: 'eSelect',
  label: '尺寸',
  model: 'size',
  props: {
    transfer: true,
    dataSource: {
      type: 'static',
      value: sizes
    }
  },
  defaultValue: 'default'
}]

const events: IComponentConfig[] = [{
  type: 'codeEditor',
  component: 'CodeEditor',
  label: 'onChange',
  model: 'on-change',
  defaultValue: `function fn() {
  
}`
}]

const slots: IComponentConfig[] = []

const drag = {
  compName: 'eDatePicker',
  label: '日期选择',
  classify: {
    label: '基础',
    value: 'basic'
  },
  channel: ChannelEnum.PC,
  group: {
    label: '表单',
    value: 'form'
  },
  icon: 'icon-calendar'
}

export default {
  drag,
  props,
  events,
  slots
}
